package com.mtzqc.common.ui.activity

import android.view.LayoutInflater
import android.view.View
import androidx.viewbinding.ViewBinding

abstract class ViewBindingActivity<VB : ViewBinding>(
    private val inflate: (LayoutInflater) -> VB
) : SupportActivity() {
    private var _binding: VB? = null

    protected val binding get() = _binding!!

    fun vbIsInitiated(): Boolean {
        return null != _binding
    }

    override fun setContentView() {
        //绑定视图
        _binding = inflate.invoke(layoutInflater)
        binding.let {
            setContentView(it.root)
            initTitleBarView(it.root)
        }
    }
}